package com.graduation.mybatis.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 * 
 * @TableName coach_recommendations
 */
@TableName(value ="coach_recommendations")
@Data
public class CoachRecommendations implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Integer recommendationId;

    /**
     * 
     */
    private String coachName;

    /**
     * 
     */
    private String description;

    /**
     * 减脂/增肌/维持等
     */
    private String targetGoal;

    /**
     * 1-5表示难度等级
     */
    private Integer difficulty;

    /**
     * 
     */
    private Date createdAt;

    @TableField(exist = false)
    private List<RecommendationMeal> meals;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    // 显式添加setMeals方法
    public void setMeals(List<RecommendationMeal> meals) {
        this.meals = meals;
    }

    // 也可以添加便捷方法
    public void addMeal(RecommendationMeal meal) {
        if (this.meals == null) {
            this.meals = new ArrayList<>();
        }
        this.meals.add(meal);
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CoachRecommendations other = (CoachRecommendations) that;
        return (this.getRecommendationId() == null ? other.getRecommendationId() == null : this.getRecommendationId().equals(other.getRecommendationId()))
            && (this.getCoachName() == null ? other.getCoachName() == null : this.getCoachName().equals(other.getCoachName()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getTargetGoal() == null ? other.getTargetGoal() == null : this.getTargetGoal().equals(other.getTargetGoal()))
            && (this.getDifficulty() == null ? other.getDifficulty() == null : this.getDifficulty().equals(other.getDifficulty()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRecommendationId() == null) ? 0 : getRecommendationId().hashCode());
        result = prime * result + ((getCoachName() == null) ? 0 : getCoachName().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getTargetGoal() == null) ? 0 : getTargetGoal().hashCode());
        result = prime * result + ((getDifficulty() == null) ? 0 : getDifficulty().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", recommendationId=").append(recommendationId);
        sb.append(", coachName=").append(coachName);
        sb.append(", description=").append(description);
        sb.append(", targetGoal=").append(targetGoal);
        sb.append(", difficulty=").append(difficulty);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}